A good answer might be:

The sample program expects to transform the characters on the second line into an int, but this cannot be done.


NumberFormatException

Here is what happens with this defective input file:

C:\users\default\JavaLessons>java AddTwo < input.txt

Enter first number:
Enter second number:
java.lang.NumberFormatException: seven

D:\users\default\JavaLessons>

The system reports that there is an error in the input, causing a "Number Format Exception." The program stops when it encounters this exception.

QUESTION 11:

Say that you have a file that contained 100 integers, one integer per line. You wish to add up all these integers. Can a program be written to do this?